
package com.wanchuang.hepos.push;

import android.content.Context;

import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.service.JPushMessageReceiver;

/**
 * Created by intexh on 2016/7/7.
 * 自定义广播接收器
 */

public class JPushReceiver extends JPushMessageReceiver {
    private static final String TAG = "frank";
    private int count = 1;
    private Integer msgId;

    @Override
    public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) {
        super.onNotifyMessageOpened(context, notificationMessage);
    }


    //    @Override
//    public void onReceive(Context context, Intent intent) {
//        Bundle bundle = intent.getExtras();
//        LogUtil.e(TAG, "[MyReceiver] 接收EXTRA_EXTRA: " +bundle.getString(JPushInterface.EXTRA_EXTRA));
//        if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
//            String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
//            LogUtil.e(TAG, "[MyReceiver] 接收Registration Id : " + regId);
//        } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
//            LogUtil.e(TAG,"[MyReceiver] 接收到推送下来的自定义消息: "+ bundle.getString(JPushInterface.EXTRA_EXTRA));
//        } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
//            LogUtil.e(TAG, "[MyReceiver] 接收到推送下来的通知");
//            int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
//            LogUtil.e(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
//        } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
//            LogUtil.e(TAG, "[MyReceiver] 用户点击打开了通知,进入app");
////             Intent intentt = new Intent(MainApplication.getAppContext(), MessageActivity.class);
////             intentt.addCategory(Intent.CATEGORY_LAUNCHER);
////             intentt.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
////             intentt.putExtra("type", 1);
////            context.startActivity(intentt);
//        } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
//            LogUtil.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK:" + bundle.getString(JPushInterface.EXTRA_EXTRA));
//        } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
//            boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
//            LogUtil.e(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
//        } else {
//            LogUtil.e(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
//        }
//    }

}

